<template>
	<view class="main-content">
		<view class="main-column" >
			<!-- 用户信息 -->
			<view class="user-info">
				<view class="info-left">
					<image :src="showData.avatar" mode="aspectFit"></image>
				</view>
				<view class="info-right">
					<view class="right-title">{{showData.nickname}}</view>
					<view class="right-time">发布于&nbsp;{{showData.time}}</view>
				</view>
			</view>
			<!-- 用户发布的内容 -->
			<view class="user-cont">
				<!-- 帖子内容 -->
				<view class="text-cont">
					{{showData.content}}
				</view>
				<!-- 图片显示 -->
				<view class="img-cont" v-if="showData.images!=0" v-for="(item,index) in showData.images" :key="index">
					<image :src="item" mode="widthFix"></image>
				</view>
			</view>
			<!-- 点赞信息 -->
			<view class="bottom-cont">
				<view class="left-label">{{showData.title}}</view>
				<view class="right-like" >
					<view class="likes" @click="likePosts(showData.id, showData.give_status)">
						<image
							:src="showData.give_status == 1 ? '/static/forum/like-check.png' : '/static/forum/like.png'"
							mode="aspectFit"
						></image>
						<text>{{ showData.give }}</text>
					</view>
					<view class="comment">
						<image
							:src="showData.comment_status == 1 ? '/static/forum/comment-check.png' : '/static/forum/comment.png'"
							mode="aspectFit"
							@click="comment = !comment"
						></image>
						<text>{{ showData.comment }}</text>
					</view>
					<view class="collection" @click="collections(showData.id, showData.collection_status)">
						<image
							:src="showData.collection_status == 1 ? '/static/forum/collection-check.png' : '/static/forum/collection.png'"
							mode="aspectFit"
						></image>
						<text>{{ showData.collection }}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import ikz from '@/pages/Common/tools.js';
	export default {
		props:['showData'],
		data(){
			return{
				like: true,
				comment: true,
				collection: true,
				flag: false,
				isShow: false,
				isFlag: false,
			}
		},
		methods: {
		
			likePosts(id, status){
				this.$emit('likePosts', id, status)
			},
			collections(id, status){
				this.$emit('collections', id, status)
			}
			
		},
	}
</script>

<style lang="scss">
	.main-content{
		.main-column{
			padding:26rpx;
			.user-info{
				padding:5rpx;
				width:100%;
				height:100rpx;
				display:flex;
				align-items: center;
				.info-left{
					height:80rpx;
					margin-right:20rpx;
					image{
						width:86rpx;
						height:86rpx;
						border-radius:50%;
					}
				}
				.info-right{
					height:80rpx;
					display:flex;
					flex-direction: column;
					justify-content: space-between;
					.right-title{
						font-size:28rpx;
					}
					.right-time{
						font-size:24rpx;
						color: #999999;
					}
				}
			}
		
		    
			.user-cont{
				margin-top:12rpx;
				.text-cont{
					font-size:28rpx;
					color:#666666;
					line-height:50rpx;
				}
				.img-cont{
					margin-top:30rpx;
					width:100%;
					image{
						border-radius:18rpx;
						width:100%;
						height:320rpx;
						margin-bottom:5%;
						&:last-child{
							margin-bottom:0;
						}
					}
				}
			}
			
		    .bottom-cont{
				margin-top:30rpx;
				width:100%;
				display:flex;
				justify-content: space-between;
				align-items:center;
				.left-label{
					width:120rpx;
					height:50rpx;
					text-align:center;
					line-height:50rpx;
					color: #FB7A26;
                    font-size:23rpx;
					background: #FFF2D9;
					border-radius:7rpx;
				}
				.right-like{
					width: 340rpx;
					font-size:22rpx;
					display:flex;
					align-items: center;
					justify-content: space-around;
					.likes{
						display:flex;
						align-items: center;
						image{
							width:50rpx;
							height:50rpx;
							margin-right:10rpx;
						}
					}
					.comment{
						display:flex;
						align-items: center;
						image{
							width:50rpx;
							height:50rpx;
							margin-right:10rpx;
						}
					}
					.collection{
						display:flex;
						align-items: center;
						image{
							width:50rpx;
							height:50rpx;
							margin-right:10rpx;
						}
					}
				}
			}
		
		}
	}
</style>
